Skip to content

fix: sync tab and pane titles when reopening renamed sessions from sidebar#344

Merged
danshapiro merged 3 commits into
mainfrom
fix/session-reopen-title-sync
May 18, 2026
Merged

fix: sync tab and pane titles when reopening renamed sessions from sidebar#344
danshapiro merged 3 commits into
mainfrom
fix/session-reopen-title-sync

Conversation

@danshapiro
Copy link
Copy Markdown
Owner

Problem

Restoring a session from the sidebar sometimes doesn't set the tab bar name to the sidebar's custom name, showing the provider label (e.g. "Claude") or directory name instead.

Root cause

Three code paths find existing tabs for a session but never sync the title:

  1. openSessionTab terminalId path
  2. openSessionTab findTabIdForSession path
  3. Sidebar.handleItemClick dedup via findPaneForSession path

Fix

  • Sync tab.title in all three existing-tab paths, gated on !titleSetByUser to preserve user-manual tab renames
  • Add hasTitle parameter to prevent synthesized fallback titles (session ID prefixes, provider labels) from overwriting auto-derived tab names
  • Sync paneTitles alongside tab.title so stale runtime pane titles don't mask the updated display
  • Fix sidebarSelectors to stop promoting local fallback titles to hasTitle=true
  • Handle split-pane layouts when syncing pane titles (walk the tree, not just leaf-only)
  • Align pane-title sync preconditions across all three paths

Tests

  • 7 new unit tests in tabsSlice.test.ts covering both thunk paths, hasTitle gating, pane title sync, and idempotency
  • 3 new e2e tests in sidebar-click-opens-pane.test.tsx covering Sidebar dedup path with title+pane sync and hasTitle=false prevention
  • 1 new e2e test in title-sync-flow.test.tsx covering tab bar display after reopen
  • Updated sidebarSelectors.test.ts for new fallback hasTitle=false semantics

Review history

  • Round 1: fresheyes (GPT) + 3-views — found fallback clobbering, paneTitles priority gap, untested sidebar path
  • Round 2: fresheyes (GPT) + 3-views — found hasTitle promotion in fallback rows, split-pane gap, indentation regression
  • All issues addressed and reviewer-verified

danshapiro pushed a commit that referenced this pull request May 17, 2026
Dan Shapiro added 3 commits May 18, 2026 15:04
When openSessionTab or Sidebar.handleItemClick finds an existing tab
for a session (via terminalId, findTabIdForSession, or
findPaneForSession), update the tab title to match the session's
current title from the sidebar. Previously only sessionMetadataByKey
was updated, leaving the tab bar showing a stale provider name or
directory name.

The update is gated on !titleSetByUser to preserve user-manual
tab renames.
…n reopen

Gate the session-reopen title sync on hasTitle to prevent
synthesized fallbacks (sessionId prefix, provider label)
from overwriting meaningful auto-derived tab titles.

Also sync paneTitles alongside tab.title in all three
code paths so that stale runtime pane titles don't
mask the updated tab display title.

- Add hasTitle parameter to openSessionTab thunk
- Gate all three existing-tab paths on hasTitle
- Update all callers to pass hasTitle
- Sync pane title via updatePaneTitle/updatePaneTitleByTerminalId
- Add 7 unit tests + 2 e2e Sidebar dedup tests
- Strengthen idempotency test with updatedAt assertion
… split-pane title sync

- Fix sidebarSelectors pushFallbackItem: never set hasTitle=true for
  fallback items (local pane/tab titles are auto-generated, not real
  session renames). This prevents the clobbering class still reachable
  through normal sidebar-backed rows.
- Fix indentation regression in Sidebar.tsx handleItemClick.
- Walk pane tree in findTabIdForSession pane-title sync instead of
  only handling type==='leaf' (fixes split-layout gap).
- Align pane-title sync preconditions across all three paths
  (require title truthiness in terminalId and Sidebar paths).
- Update sidebarSelectors tests for new hasTitle=false semantics.
@danshapiro danshapiro force-pushed the fix/session-reopen-title-sync branch from ba50e4b to 32cff19 Compare May 18, 2026 22:06
@danshapiro danshapiro merged commit bf5864e into main May 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant